package com.huitone.gddw.utils;



import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;



import org.apache.poi.ss.formula.functions.T;

import com.huitone.gddw.dao.entity.MainItem;

/**
 * 环境监控的工具类
 * @author lipengfei
 *
 */

	
public class MonitoringUtils {
	
	public static MonitoringResult<T> MonitoringException(String msg){
		MonitoringResult<T> result = new MonitoringResult<T>();
		result.setStatus(1);
		result.setMsg(msg);
		return result;
	}
	
	public static Map<String, Object> getMap(int page,int len){
		Map<String, Object> map = new HashMap<>();
		map.put("start", (page-1)*len+1);
		map.put("end", page*len);
		return map;
	};
	
	public static String saveId(String fId,String sId){
		String id = fId+":"+sId;
		return id;
	}
	public static String [] getId(String id){
		String [] ids=id.split(":");
		return ids;
	}
	public static MonitoringResult<List<MainItem>> getResult(){
		MonitoringResult<List<MainItem>> result = new MonitoringResult<List<MainItem>>();
		result.setStatus(1);
		result.setMsg("没有监控对象");
		return result;
	}
	 public static String getTimeByCalendar(Calendar cal){ 
	        int year = cal.get(Calendar.YEAR);//获取年份 
	        int month=cal.get(Calendar.MONTH);//获取月份  
	        int day=cal.get(Calendar.DATE);//获取日  
	        int hour=cal.get(Calendar.HOUR);//小时  
	        int minute=cal.get(Calendar.MINUTE);//分             
	        int second=cal.get(Calendar.SECOND);//秒  
	        int WeekOfYear = cal.get(Calendar.DAY_OF_WEEK);//一周的第几天 
	        System.out.println("现在的时间是：公元"+year+"年"+month+"月"+day+"日      "+hour+"时"+minute+"分"+second+"秒       星期"+WeekOfYear); 
	        return hour+":"+minute;
	 } 


	
	
	
	
	
	
}
